{extend name="../../admin/view/main"}

{block name="button"}
<!--{if auth("add")}-->
<button data-open='{:url("add")}' data-title="添加文章内容" class='layui-btn layui-btn-sm layui-btn-primary'>添加文章</button>
<!--{/if}-->
<!--{if auth("remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key}" data-confirm="确定要删除这些文章吗？" class='layui-btn layui-btn-sm layui-btn-primary'>删除文章</button>
<!--{/if}-->
{/block}

{block name='content'}
<div class="think-box-shadow table-block">
    <p class=" margin-bottom-15">
        演示接口文档：<a target="_blank" href="http://www.docway.net/project/1WkI0ZyQ7M1/share/1Wld0z7b1zE">http://www.docway.net/project/1WkI0ZyQ7M1/share/1Wld0z7b1zE</a>
    </p>
    {include file='article_content/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'/></label>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class="text-left nowrap">文章信息</th>
            <th class="text-left nowrap">搜索标签</th>
            <th class="text-left nowrap">文章状态</th>
            <th class="text-left nowrap">创建时间</th>
            <th class="text-left nowrap"></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'/></label>
            </td>
            <td class='list-table-sort-td'>
                <label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></label>
            </td>
            <td class="text-left nowrap">{$vo.title|default=''}</td>
            <td class="text-left nowrap">{notempty name='vo.tags'}{foreach $vo.tags as $tag}<span data-tips-text="热搜标签" class="margin-right-5 layui-badge layui-bg-cyan">{$tag}</span>{/foreach}{/notempty}<br></td>
            <td class="text-left nowrap">{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">使用中</span>{/if}</td>
            <td class="text-left nowrap">{$vo.create_at|format_datetime}</td>
            <td class='text-left nowrap'>

                {if auth("edit")}
                <a data-dbclick class="layui-btn layui-btn-sm layui-btn-xs" data-title="编辑文章文章" data-open="{:url('edit')}?id={$vo.id}">编 辑</a>
                {/if}

                {if auth("state") and $vo.status eq 1}
                <a class="layui-btn layui-btn-sm layui-btn-xs layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#0">禁 用</a>
                {/if}

                {if auth("state") and $vo.status eq 0}
                <a class="layui-btn layui-btn-sm layui-btn-xs layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#1">启 用</a>
                {/if}

                {if auth("remove")}
                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该文章吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                {/if}

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}